﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using GD.ModelContest.Model;
using GD.ModelContest.Service;
using GD.ModelContest.Common;

namespace GD.ModelContest.Web.Admin
{
    public partial class AddNews : BaseCheckPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void lkbAdd_Click(object sender, EventArgs e)
        {
            mc_news news = new mc_news();
            news.newsTypeId = Convert.ToInt32(this.ddlNewsType.SelectedValue);
            news.title = this.txtTitle.Text;
            news.content = this.txtContent.Text;
            news.creatTime = DateTime.Now;

            if (ServiceLocator.INewsService.InsertNews(news))
            {
                JavaScript.Alert("恭喜您！添加成功！", this.Page);
            }
            else
            {
                JavaScript.Alert("对不起！添加失败！", this.Page);
            }
        }
    }
}
